/**
 * 
 */
package com.fly.sms.adapter;

import java.util.List;
import java.util.Map;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.fly.sms.CommonActivity;
import com.fly.sms.R;

public class DriversListAdapter extends IAdapter {
	private List<Map<String, Object>> list=null;

	public DriversListAdapter(CommonActivity context,List<Map<String, Object>> list) {
		super(context);
		this.list=list;
	}

	public int getCount() {
		if(list==null){
			return 0;
		}
		return  list.size();
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null){
			convertView=context.getView(R.layout.driverslistitem);
		}
		Map<String, Object> drivers=list.get(position);
		TextView name=(TextView)convertView.findViewById(R.id.name);
		TextView driverNum=(TextView)convertView.findViewById(R.id.driverNum);
		TextView idNum=(TextView)convertView.findViewById(R.id.idNum);
		name.setText(drivers.get("name").toString());
		driverNum.setText(drivers.get("dirverNum").toString());
		idNum.setText(drivers.get("idNum").toString());
		return convertView;
	}
}

